package com.cty.advice;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component //将这个类放在ioc容器中
@Aspect //声明这是一个切面
public class LogAdvice {

    @Before("execution(* com..service.*.*(..))")
    public void before(JoinPoint joinPoint) {
        //类名
        String simpleName = joinPoint.getTarget().getClass().getSimpleName();
        //方法名
        String name = joinPoint.getSignature().getName();
        System.out.println(simpleName + "::" + name);
    }
}
